
package com.shop.cloud.mall.api.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shop.cloud.common.core.constant.CacheConstants;
import com.shop.cloud.mall.api.mapper.ActiveBorderRelationMapper;
import com.shop.cloud.mall.api.service.ActiveBorderRelationService;
import com.shop.cloud.mall.common.entity.ActiveBorderRelation;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 活动边框关联表
 *
 * @author
 * @date 2023-03-24 15:48:34
 */
@Service
public class ActiveBorderRelationServiceImpl extends ServiceImpl<ActiveBorderRelationMapper, ActiveBorderRelation> implements ActiveBorderRelationService {

    @Override
    @Cacheable(value = CacheConstants.MALL_ACTIVE_BORDER_RELATION_ID, key = "#activeBorderId")
    public List<String> listRelationId(String activeBorderId) {
        return baseMapper.selectList(Wrappers.<ActiveBorderRelation>query().lambda()
                        .eq(ActiveBorderRelation::getActiveBorderId, activeBorderId))
                .stream().map(ActiveBorderRelation::getRelationId).collect(Collectors.toList());
    }
}
